package cn.xxstudy.visitshop.ui.activity.main.fragment.train.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.asLiveData
import androidx.lifecycle.viewModelScope
import androidx.paging.PagingData
import androidx.paging.cachedIn
import cn.xxstudy.visitshop.ui.activity.main.fragment.train.model.TrainData
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch

/**
 * @author ：DELL on 2021/3/26 .
 * @packages ：cn.xxstudy.visitshop.ui.activity.main.fragment.train.viewmodel .
 * TODO:培训viewModel
 */
class TrainViewModel : ViewModel() {
    private val liveData = MutableLiveData<PagingData<TrainData>>()
    fun getPagingData(): Flow<PagingData<TrainData>> {
        return TrainRepository.getPagingData().cachedIn(viewModelScope)
    }
}